﻿using System;
using System.Linq;
using System.Linq.Expressions;
using System.Threading.Tasks;
using Yto.Common.Dependency;
using Yto.EF.Extensions;
using Yto.Repositories;

namespace com.ytocargo.Core.FlightInfo4Monitors
{
    public class FlightInfo4MonitorStore : IFlightInfo4MonitorStore, ITransient
    {
        private readonly IBaseRepository<FlightInfo4Monitor>  _baseRepository;

        public FlightInfo4MonitorStore(IBaseRepository<FlightInfo4Monitor> baseRepository)
        {
            _baseRepository = baseRepository;
        }

        public void Detach(FlightInfo4Monitor flightInfo4Monitor)
        {
            _baseRepository.DetachEntity(flightInfo4Monitor);
        }

        public Task<FlightInfo4Monitor> FirstOrDefaultAsync(Expression<Func<FlightInfo4Monitor, bool>> expression)
        {
            return _baseRepository.FirstOrDefaultAsync(expression);
        }

        public IQueryable<FlightInfo4Monitor> GetAll()
        {
            return _baseRepository.GetAll();
        }

        public Task InsertAsync(FlightInfo4Monitor flightInfo4Monitor)
        {
            return _baseRepository.InsertAsync(flightInfo4Monitor);
        }

        public Task UpdateAsync(FlightInfo4Monitor flightInfo4Monitor)
        {
            return _baseRepository.UpdateAsync(flightInfo4Monitor);
        }
    }
}
